package cn.xjt.hello;

/**
 * 线程优先级的设置与获取
 * @author xujiangtao
 * @create 2020-07-31-10:18
 */
public class ThreadPrioity {
    public static void main(String[] args) {
        branchThread bt = new branchThread();
        bt.setPriority(Thread.MAX_PRIORITY);    //设置线程的优先级
        bt.start();
        for(int i=0;i<20;i++)
        {
            if(i%2==0)
                System.out.println(Thread.currentThread().getPriority());
        }
    }
}
class branchThread extends Thread{
    @Override
    public void run() {
        for(int i = 0;i<20;i++)
        {
            if(i%2!=0)
                System.out.println(Thread.currentThread().getPriority());
        }
    }
}
